﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Data.Entity;

namespace University.Workshop.DataAccess
{
    public class TestData:DropCreateDatabaseIfModelChanges<WFPEntities>
    {
        
        protected override void Seed(WFPEntities context)
        {
            var q=
            new List<Model.Allotment>{
                      new Model.Allotment(){ AllotmentName="J", Square=new Model.Square(){Comment="Lejos", SquareId="1"}},
                      new Model.Allotment(){ AllotmentName="M", SquareId="1"},
                      new Model.Allotment(){ AllotmentName="N", SquareId="1"},
                      new Model.Allotment(){ AllotmentName="P", SquareId="1"},
                      new Model.Allotment(){ AllotmentName="R", SquareId="1"},
                      new Model.Allotment(){ AllotmentName="J", Square=new Model.Square(){Comment="Lejos", SquareId="2"}},
                      new Model.Allotment(){ AllotmentName="M", SquareId="2"},
                      new Model.Allotment(){ AllotmentName="N", SquareId="2"},
                      new Model.Allotment(){ AllotmentName="P", SquareId="2"},
                      new Model.Allotment(){ AllotmentName="R", SquareId="2"},
        };
            q.ForEach(a => context.Allotment.Add(a));
            context.SaveChanges();
    }
    }
}
